package com.cqu.lpss.controller;

import com.cqu.lpss.pojo.*;
import com.cqu.lpss.service.impl.SecondScoringImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/secondscoring")
public class SecondScoringController {
    @Autowired
    SecondScoringImpl secondScoringImpl;
    @PostMapping("/isEmpty")
    public Result isEmpty(){
        return Result.success(secondScoringImpl.EmptyNum());
    }
    @PostMapping("/proUnscoreNum")
    public Result proUnscoreNum(){
        List<ChartsData> professorUnscoreNums =secondScoringImpl.proUnscoreNum();
        return Result.success(professorUnscoreNums);
    }
    @PostMapping("/count")
    public Result count(){
        return Result.success(secondScoringImpl.count());
    }
    @PostMapping("/prjsScoreByProId")
    public  Result prjScoreByproId(@RequestParam Integer proIndex){
        List<Projects> projectsList = secondScoringImpl.prjSocreByProIndex(proIndex);
        return Result.success(projectsList);
    }
    @PostMapping("/recordDetailScores")
    public Result recordDetailScores(@RequestBody List<Scoredetail2> scoredetail2s){
        int i = secondScoringImpl.modifyScore(scoredetail2s);
        if(i!=0){
            return Result.success();
        }
        return Result.erro("未知错误");
    }
}
